package com.example.admin.yuejian_22.Fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.admin.yuejian_22.Activity.ClubDetailActivity;
import com.example.admin.yuejian_22.Listener.UserListener;
import com.example.admin.yuejian_22.Model.UserModel;
import com.example.admin.yuejian_22.R;
import com.squareup.picasso.Picasso;

/**
 * Created by Admin on 2017/10/20.
 */

public class ClubDetail_AFragment extends Fragment {
    private View view = null;
    TextView text_club_intro;
    TextView text_club_address;
    TextView text_club_phone;
    TextView text_club_time;
    ImageView img_teacher;



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
        view = inflater.inflate(R.layout.item_club_intro,container,false);
        text_club_intro = (TextView) view.findViewById(R.id.text_club_intro);
        text_club_address = (TextView) view.findViewById(R.id.text_club_address);
        text_club_phone = (TextView) view.findViewById(R.id.text_club_phone);
        text_club_time = (TextView) view.findViewById(R.id.text_club_time);
        img_teacher = (ImageView) view.findViewById(R.id.img_teacher);
        Intent intent = getActivity().getIntent();
        text_club_intro.setText(intent.getStringExtra("intro"));
        text_club_address.setText(intent.getStringExtra("address"));
        text_club_phone.setText(intent.getStringExtra("phone"));
        text_club_time.setText(intent.getStringExtra("time"));
        Picasso.with(view.getContext()).load("http://172.24.10.175/workout/api.php/get/mod/club/SessionID/2ul9sj8vlfoZ122e1s98048k2/related/1/id/1/map/Clubteacher/"+intent.getStringExtra("thumb")).into(img_teacher);

        text_club_phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + text_club_phone);
                intent.setData(data);
                startActivity(intent);
            }
        });

        return view;
    }

}
